<?php
if (LZ_MODULE != 'index') die('Access Denied');
$view_data = $config;
$view_data['user'] = $_SESSION['login_user']['email'];

$me="http://".$_SERVER["SERVER_NAME"].dirname($_SERVER["PHP_SELF"]);
$view_data['me'] = $me."/";
$view_data['me1'] = dirname($me);
$view_data['root'] = $_SESSION['user']['root'];

define('ROOT',$customer['name']);
$view_data['icons'] = array();
$view_data['refresh_time'] = $config['refresh_time']?$config['refresh_time']:60;
$view_data['account'] = $_SESSION['login_user']['email'];


if (is_readable(LZ_TOPPATH.'public/images/icons'))
{
	$handle = @opendir(LZ_TOPPATH.'public/images/icons');
	while($val = @readdir($handle))
	{
		if ($val == '.' || $val == '..' || !file_exists(LZ_TOPPATH.'public/images/icons/'.$val) || is_dir(LZ_TOPPATH.'public/images/icons/'.$val)) continue;
		
		$arr = explode('.',$val);
		if(count($arr) != 2) continue;
		$name = $arr[0];
		$ext = strtolower($arr[1]);
		if (strpos('|jpg|jpeg|png|gif|',"|$ext|") === false) continue;
		if (strpos($name,'icon_') === false) continue;


		$view_data['icons'][] = array(
			'type' => str_replace('icon_','',$name),
			'image' => $val
		);
	}
	@closedir($handle);
}
else
{
	echo "alert('".LZ_TOPPATH.'public/images/icons'." can not be read by php!');";
}

?>
